﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Text;
using LinFu.IoC.Configuration;

namespace CoreEx.DynamicInvoker.Implementation
{
    [Implements(typeof(IDynamicFactory<FieldInfo>),LifecycleType.OncePerThread,ServiceName = "FieldSetterFactory")]
    public class FieldSetterFactory : FieldFactoryBase
    {        
        
        
        protected override void EmitMethodBody(ILGenerator ilGenerator, FieldInfo target)
        {
            ilGenerator.Emit(OpCodes.Stfld, target);
           
        }

        public override Type GetReturnType(FieldInfo member)
        {
            return typeof (void);
        }

        public override IEnumerable<Type> GetParameters(FieldInfo member)
        {
            return new List<Type>(new [] {member.FieldType});
        }

        
    }
}
